package com.fh.modules.dbms.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fh.modules.dbms.entity.DbmsPackage;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @Author qiujunda
 * @Date 02/08/2020
 * @Description
 */
public class PackageCompareResult {
    public  PackageCompareResult(){
    }
    public  PackageCompareResult(String packageName1,String packageName2){
        this.packageName1=packageName1;
        this.packageName2=packageName2;
        this.declareResult=false;
        this.bodyResult=false;
        this.result=false;
    }

    private String packageName1;
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date delcareLastDdlTime1;
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date bodyLastDdlTime1;

    private String packageName2;
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date delcareLastDdlTime2;
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date bodyLastDdlTime2;

    private boolean declareResult;

    private boolean bodyResult;

    private boolean result;

    public String getPackageName1() {
        return packageName1;
    }

    public void setPackageName1(String packageName1) {
        this.packageName1 = packageName1;
    }

    public String getPackageName2() {
        return packageName2;
    }

    public void setPackageName2(String packageName2) {
        this.packageName2 = packageName2;
    }

    public boolean isDeclareResult() {
        return declareResult;
    }

    public void setDeclareResult(boolean declareResult) {
        this.declareResult = declareResult;
    }

    public boolean isBodyResult() {
        return bodyResult;
    }

    public void setBodyResult(boolean bodyResult) {
        this.bodyResult = bodyResult;
    }

    public boolean isResult() {
        return result;
    }

    public void setResult(boolean result) {
        this.result = result;
    }

    public Date getDelcareLastDdlTime1() {
        return delcareLastDdlTime1;
    }

    public void setDelcareLastDdlTime1(Date delcareLastDdlTime1) {
        this.delcareLastDdlTime1 = delcareLastDdlTime1;
    }

    public Date getBodyLastDdlTime1() {
        return bodyLastDdlTime1;
    }

    public void setBodyLastDdlTime1(Date bodyLastDdlTime1) {
        this.bodyLastDdlTime1 = bodyLastDdlTime1;
    }

    public Date getDelcareLastDdlTime2() {
        return delcareLastDdlTime2;
    }

    public void setDelcareLastDdlTime2(Date delcareLastDdlTime2) {
        this.delcareLastDdlTime2 = delcareLastDdlTime2;
    }

    public Date getBodyLastDdlTime2() {
        return bodyLastDdlTime2;
    }

    public void setBodyLastDdlTime2(Date bodyLastDdlTime2) {
        this.bodyLastDdlTime2 = bodyLastDdlTime2;
    }

    public void initLastDdlTime(DbmsPackage dbmsPackage1,DbmsPackage dbmsPackage2){
        if(dbmsPackage1!=null){
            this.setDelcareLastDdlTime1(dbmsPackage1.getPackageLastDdlTime());
            this.setBodyLastDdlTime1(dbmsPackage1.getBodyLastDdlTime());
        }
        if(dbmsPackage2!=null){
            this.setDelcareLastDdlTime2(dbmsPackage2.getPackageLastDdlTime());
            this.setBodyLastDdlTime2(dbmsPackage2.getBodyLastDdlTime());
        }
    }
}
